﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SerialportSample
{
    public partial class OutSet : Form
    {
        public OutSet(Form f)
        {
            InitializeComponent();
            /*
            this.Owner = f;
            string name = ((SerialportSampleForm)(this.Owner)).getoutFileName();
            if (name != null)
            {
                this.textBox1.Text = name;
                this.textBox2.Text = name + ".dat";
                ((SerialportSampleForm)(this.Owner)).setFile2(this.textBox2.Text);
            }
            */
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = "c:\\";//注意里写路径时要用c:\\而c:\
            openFileDialog.Filter = "配置文件|*.*|配置文件|*.dat|所有文件|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                String path = openFileDialog.SafeFileName;
                this.textBox1.Text = path;
             //  ((SerialportSampleForm)(this.Owner)).setFile1(path);
               // button1.Visible = false;
            }
        }

        private void button2_Click_1(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = "c:\\";//注意里写路径时要用c:\\而c:\
            openFileDialog.Filter = "配置文件|*.*|配置文件|*.dat|所有文件|*.*";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                String path = openFileDialog.SafeFileName;
                this.textBox2.Text = path;
            //    ((SerialportSampleForm)(this.Owner)).setFile2(path);
            }
        }
    }
}
